home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / internet / irc_i_dodatki / kuang / kuangeleven28.lha / Rexx / tracker.amirx < prev   
Text File  |  1996-11-19  |  2KB  |  90 lines

  1. /*tracker by marmoset*/
  2. iplist = ''
  3. topnum = 0
  4. flood = 5
  5. parse arg device time
  6. if device='' then device='ppp.device'
  7. if time = '' then time = 20
  8. vecho("Monitoring" device "ICMP's for "time" seconds..")
  9. dtime = time * 50
  10. address command 'run >NIL: amitcp:bin/sanamon' device '0 > t:tracker'
  11. delay(dtime)
  12. address command 'status > t:tracker.status'
  13. open(t,'t:tracker.status',r)
  14.  
  15. do until task = 'amitcp:bin/sanamon'
  16. t1 = readln(t)
  17. parse var t1 process' 'tasknum': 'blah': 'task
  18. end
  19.  
  20. address command 'break 'tasknum
  21.  
  22. close(t)
  23.  
  24. address command 'delete t:tracker.status'
  25.  
  26. open(t,'t:tracker',r)
  27.  
  28. t1 = readln(t)
  29.  
  30. t1 = readln(t)
  31.  
  32. do until eof(t)
  33.  
  34.     t1 = readln(t)
  35.  
  36.     parse var t1 'in 'inbyte' bytes, type='type', err='err', werr='werr', HOST, 'fip.1':'fip.2':'fip.3':'fip.4'->'rest
  37.     if fip.1 ~= ''  then do
  38.         do i = 1 to 4
  39.             fip.i = x2d(fip.i)
  40.         end
  41.         ip = fip.1'|'fip.2'|'fip.3'|'fip.4
  42.         x = find(iplist,ip)
  43.         if x ~= 0 then do
  44.             iptimes.x = iptimes.x + 1
  45.             ipbytes.x = ipbytes.x + inbyte
  46.             if x > topnum then topnum = x
  47.         end
  48.         else do
  49.             iplist = iplist||ip' '
  50.             a = find(iplist,ip)
  51.             iptimes.a = 1
  52.             ipbytes.a = inbyte
  53.         end
  54.     end
  55. end
  56. close(t)
  57. vecho("Monitoring over")
  58. address command 'delete t:tracker'
  59. vecho("Checking to see if anyone was ICMP flooding..")
  60. do i = 1 to topnum
  61.     if iptimes.i >= flood then do
  62.         address command 'amitcp:bin/askhost 'translate(word(iplist,i),'.','|')' >t:tracker'
  63.         open(t,'t:tracker',r)
  64.         do until eof(t)
  65.             t1=readln(t)
  66.             if t1 = 'gethostbyaddr: Unknown host' then do
  67.                 vecho(bold(ipbytes.i' bytes from 'translate(word(iplist,i),'.','|')))
  68.                 vecho(Checking for matches)
  69.                 'say /who 'translate(word(iplist,i),'.','|')
  70.             end    
  71.             if left(t1,5)='host:' then do
  72.                 parse var t1 'host:'host'addrtype'blah
  73.                 host = strip(host)
  74.                 vecho(bold(ipbytes.i' bytes from 'host))
  75.                 if upper(right(host,12)) ~= 'UNDERNET.ORG' then do
  76.                     do
  77.                         vecho("Checking for possible matches..")
  78.                         'say /who 'host
  79.                         'say /who 'translate(word(iplist,i),'.','|')
  80.                     end    
  81.                 end
  82.             end    
  83.         end
  84.     close(t)
  85.     end
  86. end
  87. vecho("Tracking over")
  88. exit
  89. vecho:;"ECHO P="d2c(27)"b«Tracker»" arg(1);return 0
  90. bold:;bold=d2c(2);return bold||arg(1)||bold